import request from '@/utils/request';

const PRE_URL = '/market/product';

/**
 * 根据条件查询信息
 * @param {*} params
 */
export async function query(params) {
  return request(`${PRE_URL}/getByPage`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 触发
 */
export async function sendMarketProducts(params) {
  return request(`${PRE_URL}/sendProducts`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 销售达标商品从限时抢购活动中下架
 */
export async function soldOutCheck() {
  return request(`${PRE_URL}/soldOutCheck`, {
    method: 'POST',
    data: {},
  });
}

/**
 * 下架某一个商品
 * @param {*} params
 */
export async function soldOutProductById(params) {
  const { id } = params;
  return request(`${PRE_URL}/soldOutCheck/${id}`, {
    method: 'POST',
    data: {},
  });
}
